<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<script>
  $(function() {
    $("input[name=cinemaInfo]").click(function(){
    	var index = $(this).attr('id');
    	var latComp = $("input[name=lat"+index+"]").val();
    	var lngComp = $("input[name=lng"+index+"]").val();
    	location.href="${initParam.root}movie/cinemaListBylatlng.do?lat="+latComp+"&lng="+lngComp;
    });
    $("input[name=deleteTicketing]").click(function(){
    	//alert($(this).attr('id'));
    });
  });
</script>
<h3>예매 확인</h3>
<hr align="left" width="150">
<center>
<table class="ticketing">
	<c:choose>
		<c:when test="${requestScope.ticketingMap.flag=='Y'}">
			<c:forEach var="ticketingVO" items="${requestScope.ticketingMap.ticketingList}" varStatus="status">
			<tr>
				<td rowspan="7">
					<img src="${initParam.root }${ticketingVO.scheduleTimeVO.scheduleDateVO.showingVO.movieVO.posterPath}" width="150" height="200">
				</td>
				<td align="center" colspan="2">
					${ticketingVO.scheduleTimeVO.scheduleDateVO.showingVO.movieVO.title}<br>
				</td>
				<%-- <td rowspan="7">
					<input type="button" id="${ticketingVO.ticketingNo }" name="deleteTicketing" value="삭제">
				</td> --%>
			</tr>
			<tr>
				<td width="90" align="center">
					예매번호
				</td>
				<td align="center" width="200">
					${ticketingVO.ticketingNo }
				</td>
			</tr>
			<tr>
				<td align="center">
					관람 일시
				</td>
				<td>
					${ticketingVO.scheduleTimeVO.scheduleDateVO.date} ${ticketingVO.scheduleTimeVO.time}:00
				</td>
			</tr>
			<tr>
				<td align="center">
					관람 극장
				</td>
				<td>
					${ticketingVO.scheduleTimeVO.scheduleDateVO.showingVO.cinemaVO.name}
					<input type="button" id="${ticketingVO.scheduleTimeVO.scheduleDateVO.showingVO.cinemaVO.cinemaNo}" name="cinemaInfo" value="극장정보">
					<input type="hidden" name="lat${ticketingVO.scheduleTimeVO.scheduleDateVO.showingVO.cinemaVO.cinemaNo}" value="${ticketingVO.scheduleTimeVO.scheduleDateVO.showingVO.cinemaVO.lat}">
					<input type="hidden" name="lng${ticketingVO.scheduleTimeVO.scheduleDateVO.showingVO.cinemaVO.cinemaNo}" value="${ticketingVO.scheduleTimeVO.scheduleDateVO.showingVO.cinemaVO.lng}">
				</td>
			</tr>
			<tr>
				<td align="center">
					좌석 번호
				</td>
				<td>
					${ticketingVO.seat}
				</td>
			</tr>
			<tr>
				<td align="center">
					인원
				</td>
				<td>
					<c:if test="${ticketingVO.adultNum!= 0 }">${ticketingVO.adultNum}명(성인)</c:if> 
					<c:if test="${ticketingVO.stuNum!= 0 }">${ticketingVO.stuNum }명(학생)</c:if>
				</td>
			</tr>
			<tr>
				<td align="center">
					결제 금액
				</td>
				<td>
					${ticketingVO.adultNum*8000 + ticketingVO.stuNum*6000}원
				</td>
			</tr>
			</c:forEach>
		</c:when>
		<c:otherwise>
			<tr>
				<td align="center">예매 하신 내역이 없습니다. </td>
			</tr>
		</c:otherwise>
	</c:choose>
</table>
</center>